package com.hqq.structure.facade;

/**
 * Computer
 * 外观模式（Facade）
 *
 * 解决类与类之家的依赖关系的
 * 将他们的关系放在一个Facade类中，降低了类类之间的耦合度，该模式中没有涉及到接口
 *
 * Created by heqianqian on 2017/3/11.
 */
public class Computer {

    private CPU cpu;
    private Memory memory;
    private Disk disk;

    public Computer() {
        cpu = new CPU();
        memory = new Memory();
        disk = new Disk();
    }

    public void startUp(){
        System.out.println("start the computer!");
        cpu.startUp();
        memory.startUp();
        disk.startUp();
        System.out.println("start computer finished!");
    }

    public void shutDown(){
        System.out.println("begin to close the computer!");
        cpu.shutDown();
        memory.shutDown();
        disk.shutDown();
        System.out.println("computer closed!");
    }
}
